package pers.litao.bit.gateway.exception;



import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import pers.litao.bit.commons.utils.Constant;
import pers.litao.bit.commons.utils.R;

/**
 * @author 李涛
 * @date 2020-07-10 14:31
 */
//@ResponseBody
@RestControllerAdvice
public class MyExceptionControllerAdvice {

    @ExceptionHandler(value = Exception.class)
    public R allException(Exception e){
        return R.error(Constant.ResponseCode.SERVER_EXCEPTION.getCode(),
                Constant.ResponseCode.SERVER_EXCEPTION.getMsg() +":"+e.getMessage(),null);
    }
}
